package hit.core;
import hit.reports.Visitor;

/**
 * Defines a room, closet, pantry, cupboard, or some other enclosed area where
 * items can be stored.
 */
public class StorageUnit extends ProductContainer
{
	/**
	 * Creates a new Instance of StorageUnit
	 * @param name The name of the StorageUnit
	 */
	public StorageUnit(String name)
	{
		super(name);
	}
	
	/**
	 * Checks to see if a given StorageUnit is valid.
	 * @param storageUnit The storageUnit to check.
	 * @return True if the storageUnit is valid, false otherwise.
	 */
	@Override
	public boolean IsValid()
	{
		return !name.isEmpty();
	}
	
	@Override
	public void Accept(Visitor visitor){
		visitor.VisitStorageUnit(this);
		for (ProductGroup gp : productGroups){
			gp.Accept(visitor);
		}
	}
	
	@Override
	public void AcceptPost(Visitor visitor){
		for (ProductGroup gp : productGroups){
			gp.AcceptPost(visitor);
		}
		visitor.VisitStorageUnit(this);
	}
}
